import postRequest from "@/axios/post/index.js";
import getRequest from "@/axios/get/index.js";

function defaultFun(body) {
}

function getPokeList(body) {
    return new Promise((resolve, reject) => {
        postRequest("/poke/poke/list", body).then((result) => {
            resolve(result)
        })
    })
}

function getMyPokeList(groupId, userId, body) {
    return new Promise((resolve, reject) => {
        postRequest("/poke/pokeGroupUserPoke/pokeList?groupId="
            + groupId
            + "&userId=" + userId, body).then((result) => {
            resolve(result)
        })
    })
}

function releasePoke(groupId, userId, pokeId, isRelease) {
    return new Promise((resolve, reject) => {
        getRequest("/poke/pokeGroupUserPoke/releasePoke?groupId="
            + groupId
            + "&userId=" + userId
            + "&pokeId=" + pokeId
            + "&isRelease=" + isRelease).then((result) => {
            resolve(result)
        })
    })
}

function getPokeSkillList(body) {
    return new Promise((resolve, reject) => {
        postRequest("/poke/pokeSkill/list", body).then((result) => {
            resolve(result)
        })
    })
}

function onSubmitLogin(groupId, userId) {
    return new Promise((resolve, reject) => {
        getRequest("/q/qGroupUser/login?groupId="
            + groupId
            + "&userId=" + userId).then((result) => {
            resolve(result)
        })
    })
}

function canLearnSkill(attribute1, attribute2) {
    return new Promise((resolve, reject) => {
        getRequest("/poke/pokeSkill/canLearn?attribute1=" + attribute1 + "&attribute2=" + attribute2).then((result) => {
            resolve(result)
        })
    })
}

function createDuel(body) {
    return new Promise((resolve, reject) => {
        postRequest("/poke/pokeDuel/createDuel", body).then((result) => {
            resolve(result)
        })
    })
}

function duelList(body) {
    return new Promise((resolve, reject) => {
        getRequest("/poke/pokeDuel/duelList", body).then((result) => {
            resolve(result)
        })
    })
}

function duelDetail(duelId) {
    return new Promise((resolve, reject) => {
        getRequest("/poke/pokeDuelDetail/duelDetailList?duelId=" + duelId).then((result) => {
            resolve(result)
        })
    })
}

function joinDuel(body) {
    return new Promise((resolve, reject) => {
        postRequest("/poke/pokeDuel/joinDuel", body).then((result) => {
            resolve(result)
        })
    })
}

export default defaultFun

export {
    defaultFun,
    getPokeList,
    getMyPokeList,
    releasePoke,
    getPokeSkillList,
    onSubmitLogin,
    canLearnSkill,
    createDuel,
    duelList,
    duelDetail,
    joinDuel,
}